/**
 * 
 */
package demo.dcs.util;

import demo.dcs.vo.SpringTraceModel;

import java.util.Map;

/**
 * @author mandy.hu
 *
 */
public class SpringTraceContext {
	
	private ThreadLocal<SpringTraceModel> springTraceModelLocal = new ThreadLocal<SpringTraceModel>();
	
	private static SpringTraceContext instance = new SpringTraceContext();
	 
	  
	public static SpringTraceContext getSpringTraceContext() {
	    return SpringTraceContext.instance;
	}

	public SpringTraceModel getSpringTraceModel() {
		return springTraceModelLocal.get();
	}

	public void setSpringTraceModel(SpringTraceModel springTraceModel) {
		springTraceModelLocal.set(springTraceModel);
	}
	
	public void removeSpringTraceModel() {
		if (springTraceModelLocal!=null) {
			springTraceModelLocal.remove();
		}
	}
	public String getRestUrl() {
		if (springTraceModelLocal!=null && springTraceModelLocal.get()!=null) {
			return springTraceModelLocal.get().getRestUrl();
		}
		return null;
	}
	public Map getRestParam() {
		if (springTraceModelLocal!=null && springTraceModelLocal.get()!=null) {
			return springTraceModelLocal.get().getRestParam();
		}
		return null;
	}
	
	

}
